Definition

Define an algorithm in the word RAM model of computation as follows:

Algorithm is sequence of instructions each executing in constant time O(1)O(1), e.g.

We may further distinguish these operations taking constant time, by their circuit complexity:

Rank operation

The Rank operation is performed on the packed word XX containing kk keys, and the objective is to find the number of keys with value greater than qq. Hence, by subtracting qˆ\hat q = [0 q | 0 q | ... | 0q] from XX, where XX = [ 1 x_1 | 1 x_2 | ... | 1 x_k ] we obtain the rank from [c1 | 0 | c_2 | 0 ...] number of ci=1c_i = 1 due to borrowing which would make ci=0c_i = 0 if xi<qx_{i} < q. Hence this is considered O(1)O(1) by using AC0AC_0 operations of subtraction and significant bits.

Notes

See also


References

  1. https://en.wikipedia.org/wiki/Word_RAM
  2. https://opendatastructures.org/versions/edition-0.1e/ods-cpp/1_3_Model_Computation.html
  3. https://people.seas.harvard.edu/~cs125/fall14/lec6.pdf
  4. https://bowaggoner.com/courses/gradalg/notes/lect01-intro.pdf
  5. https://www.cs.au.dk/~gerth/slides/afapa08.pdf